# # 上台阶
# n=int(input())
# dp=[0]*(n+1)
# dp[1],dp[2]=1,2
# for i in range(3,n+1):
#     dp[i]=dp[i-1]+dp[i-2]
#
# print(dp[n])

# n,m=map(int,input().split())
# a=list(map(int,input().split()))
#
# dp=[0]*(n+1)
# vis=[0]*(n+1)
#
# for x in a:
#     vis[x]=1
#
# dp[0]=1
# dp[1]=1-vis[1]
#
# for i in range(2,n+1):
#     if vis[i]==1:
#         continue
#     dp[i]=(dp[i-1]+dp[i-2])%100000007
#
# print(dp[n])

MOD=10000000007
n,k=map(int,input().split())
dp=[0]*(n+1)

# 初始状态: 不放置也是一种状态
dp[0]=1
for i in range(1,n+1):
    if i-k-1>=0:
        # dp[i-1]表示这个位置不放置,dp[i-k-1]放置,查看之前的情况
        dp[i]=(dp[i-1]+dp[i-k-1])%MOD
    else:
        dp[i]=(dp[i-1]+1)%MOD

print(dp[n])